home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / misc / ObtainGIRPort.lha / NewObtainGIRPort.doc < prev   
Text File  |  1995-01-29  |  3KB  |  64 lines

  1.     NewObtainGIRPort 1.0
  2.  
  3.     Written by Osma Ahvenlampi, Public Domain
  4.     This program comes with NO WARRANTY. Use at your own risk.
  5.  
  6. BACKGROUND
  7.  
  8.     NewObtainGIRPort is a simple patch to the Intuition ObtainGIRPort() call,
  9.     making certain BOOPSI gadgets and hacks such as Magic Menu and CycleToMenu
  10.     co-exist peacefully.
  11.  
  12.     After using textfield.gadget, by Mark Thomas, in a program of mine, the
  13.     tendency of it to go into a deadlock situation with Magic Menu became
  14.     unbearable. I was pointed to a patch for this, called PatchOGR, also by
  15.     Mark Thomas. However, this program had even MORE problems, which I will
  16.     outline below, so I wrote my own.
  17.  
  18. USAGE
  19.  
  20.     To install the patch, run NewObtainGIRPort from CLI. To keep the size
  21.     to the minimum, it has no Workbench startup code.
  22.     
  23.     You should add the line "Run <>NIL: NewObtainGIRPort <>NIL:" to your
  24.     User-Startup, if you want to use this patch.
  25.     
  26.     After installing the patch, NewObtainGIRPort will stick around,
  27.     waiting for a CTRL-C signal, on which it will (if possible) remove the
  28.     patch and exit. If another program has patched over NewObtainGIRPort,
  29.     it will flash the screen and refuse to quit.
  30.     
  31. EXPLANATION
  32.  
  33.     This patch adds a safety check in the ObtainGIRPort() call, by
  34.     checking whether the layer of the GadgetInfo structure is already
  35.     locked. If it is, the patch will simply return NULL.
  36.     
  37.     The version of this patch by Mark Thomas had two major problems.
  38.     First, it did not check whether the GadgetInfo had a valid layer, but
  39.     simply called AttemptLockLayerRom() with a NULL layer. This is
  40.     illegal. Secondly, it subsequently called ObtainGIRPort() while having
  41.     itself locked the layer of the gadget. This is even more illegal.
  42.     
  43.     My version does not do either of these ;). This version leaves a
  44.     minimal window for a deadlock situation open, as the GadgetInfo layer
  45.     is free'd before obtaining the RastPort of the gadget. The probability
  46.     of another task locking the layer in between these two operations is,
  47.     however, so small, that I did not think it warrants enclosing the
  48.     patch inside Forbid()/Permit(). If you wish to add that, the change in
  49.     the source is trivial.
  50.     
  51.     Thanks to Greg Block in helping to find the problem in PatchOGR.
  52.  
  53. AUTHOR
  54.     
  55.     Email: <Osma.Ahvenlampi@hut.fi>
  56.     
  57.     Snailmail: Osma Ahvenlampi
  58.                Rekipellontie 2 F 55
  59.                00940 Helsinki
  60.                Finland
  61.              
  62.     I wouldn't mind a postcard from you if you think this is a useful
  63.     program...
  64.